<?php
namespace app\admin\controller;
// use think\Db;
// use think\captcha\Captcha;
class Shopin extends Come{
    public function shopin(){
        if(isset($_POST['up'])){
            // $shop_name=input('param.shop_name','','htmlspecialchars');
            // $name=input('param.name','','htmlspecialchars');
            // $pnum=input('param.pnum','','htmlspecialchars');
            // $display=input('param.display','','htmlspecialchars');
            $shop_name=input('param.shop_name','','htmlspecialchars');
            $num=input('param.num','','htmlspecialchars');
            $pnum=$_POST['pnum'];
            $display=$_POST['display'];
            $time=time();

            $id_num=input('param.num','','htmlspecialchars');

            $data=[
                'num'=>$num,
                'name'=>$shop_name,
                'pnum'=>$pnum,
                'display'=>$display,
                'time'=>$time
            ];

            $ret=db('admin_shop')->insertGetId($data);
            if($ret>0){
                $this->success('添加成功!','admin/shopin/shopin');
            }else{
                $this->error('添加失败');
            }
            
        }
       
        $res=db('admin_shop')->where('num<=1' )->select();
        $this->assign('res',$res);
        return $this->fetch('shopin');
    }
    
}